package com.industrial.premu.service.impl;

import java.util.Date;
import java.util.List;

import com.industrial.common.core.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.industrial.premu.mapper.PreMuRateMapper;
import com.industrial.premu.domain.PreMuRate;
import com.industrial.premu.service.IPreMuRateService;

/**
 * 评级管理Service业务层处理
 * 
 * @author Zhou_S
 * @date 2024-01-22
 */
@Service
public class PreMuRateServiceImpl implements IPreMuRateService 
{
    @Autowired
    private PreMuRateMapper preMuRateMapper;

    /**
     * 查询评级管理
     * 
     * @param baseId 评级管理主键
     * @return 评级管理
     */
    @Override
    public PreMuRate selectPreMuRateByBaseId(String baseId)
    {
        return preMuRateMapper.selectPreMuRateByBaseId(baseId);
    }

    /**
     * 查询评级管理列表
     * 
     * @param preMuRate 评级管理
     * @return 评级管理
     */
    @Override
    public List<PreMuRate> selectPreMuRateList(PreMuRate preMuRate)
    {

        return preMuRateMapper.selectPreMuRateList(preMuRate);
    }

    /**
     * 新增评级管理
     * 
     * @param preMuRate 评级管理
     * @return 结果
     */
    @Override
    public int insertPreMuRate(PreMuRate preMuRate)
    {
        preMuRate.setBaseId(IdUtils.simpleUUID());
        preMuRate.setBaseCreateTime(new Date());
        return preMuRateMapper.insertPreMuRate(preMuRate);
    }

    /**
     * 修改评级管理
     * 
     * @param preMuRate 评级管理
     * @return 结果
     */
    @Override
    public int updatePreMuRate(PreMuRate preMuRate)
    {
        return preMuRateMapper.updatePreMuRate(preMuRate);
    }

    /**
     * 批量删除评级管理
     * 
     * @param baseIds 需要删除的评级管理主键
     * @return 结果
     */
    @Override
    public int deletePreMuRateByBaseIds(String[] baseIds)
    {
        return preMuRateMapper.deletePreMuRateByBaseIds(baseIds);
    }

    /**
     * 删除评级管理信息
     * 
     * @param baseId 评级管理主键
     * @return 结果
     */
    @Override
    public int deletePreMuRateByBaseId(String baseId)
    {
        return preMuRateMapper.deletePreMuRateByBaseId(baseId);
    }


    public boolean getByDistrictCode(String districtCode,String years) {
        PreMuRate  preMuRateNew=new PreMuRate();
        preMuRateNew.setDistrictCode(districtCode);
        preMuRateNew.setYears(years);
        PreMuRate  preMuRate= preMuRateMapper.getByDistrictCode(preMuRateNew);
        if(preMuRate!=null){
            return  true;
        }else{
            return false;
        }
    }


}
